gtk/native/Makefile
libgail-util/Makefile
modules/Makefile
-modules/engines/Makefile
-modules/engines/pixbuf/Makefile
modules/input/Makefile
modules/printbackends/Makefile
modules/printbackends/cups/Makefile
include $(top_srcdir)/Makefile.decl
-SUBDIRS = input engines
+SUBDIRS = input
if OS_UNIX
SUBDIRS += printbackends
+++ /dev/null
-include $(top_srcdir)/Makefile.decl
-
-# the pixbuf engine needs to be ported to GtkThemingEngine
-SUBDIRS = # pixbuf
-
-DIST_SUBDIRS = pixbuf
-
-
--include $(top_srcdir)/git.mk
+++ /dev/null
-include $(top_srcdir)/Makefile.decl
-
-if PLATFORM_WIN32
-no_undefined = -no-undefined
-endif
-
-AM_CPPFLAGS = \
- -I$(top_srcdir) \
- -I$(top_srcdir)/gdk \
- -I$(top_builddir)/gdk \
- -DGDK_DISABLE_DEPRECATED \
- $(GTK_DEP_CFLAGS)
-
-LDADDS = \
- $(GTK_DEP_LIBS) \
- $(top_builddir)/gdk/libgdk-3.la \
- $(top_builddir)/gtk/libgtk-3.la
-
-enginedir = $(libdir)/gtk-3.0/$(GTK_BINARY_VERSION)/engines
-
-engine_LTLIBRARIES = libpixmap.la
-
-libpixmap_la_SOURCES = \
- pixbuf-draw.c \
- pixbuf-main.c \
- pixbuf-render.c \
- pixbuf-rc-style.c \
- pixbuf-rc-style.h \
- pixbuf-style.h \
- pixbuf.h
-
-libpixmap_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixmap_la_LIBADD = $(LDADDS)
-
-
--include $(top_srcdir)/git.mk
+++ /dev/null
-The code in this directory is a GTK+ theme engine based on the earlier
-pixmap theme engine.
-
-The config files are meant to be compatible, but instead of rendering
-using Imlib, it renders using GdkPixbuf. This makes the memory
-management much more understandable, and also allows us to use
-GdkPixbuf's high quality scaling.
-
-Most of the code was reworked/rewritten in the process to make it more
-understandable and maintainable.
-
-There are lots of bugs here, a considersable number of bugs. But it's
-cleaned up a great deal from the older pixmap engine. Please don't
-make it uglier again.
-
-Owen Taylor <otaylor@redhat.com>
-6 February 2000
\ No newline at end of file
+++ /dev/null
-/* GTK+ Pixbuf Engine
- * Copyright (C) 1998-2000 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Written by Owen Taylor <otaylor@redhat.com>, based on code by
- * Carsten Haitzler <raster@rasterman.com>
- */
-
-#include <math.h>
-#include <string.h>
-
-#include "pixbuf.h"
-#include "pixbuf-rc-style.h"
-#include "pixbuf-style.h"
-
-static void pixbuf_style_init (PixbufStyle *style);
-static void pixbuf_style_class_init (PixbufStyleClass *klass);
-
-static GtkStyleClass *parent_class = NULL;
-
-static ThemeImage *
-match_theme_image (GtkStyle *style,
- ThemeMatchData *match_data)
-{
- GList *tmp_list;
-
- tmp_list = PIXBUF_RC_STYLE (style->rc_style)->img_list;
-
- while (tmp_list)
- {
- guint flags;
- ThemeImage *image = tmp_list->data;
- tmp_list = tmp_list->next;
-
- if (match_data->function != image->match_data.function)
- continue;
-
- flags = match_data->flags & image->match_data.flags;
-
- if (flags != image->match_data.flags) /* Required components not present */
- continue;
-
- if ((flags & THEME_MATCH_STATE) &&
- match_data->state != image->match_data.state)
- continue;
-
- if ((flags & THEME_MATCH_SHADOW) &&
- match_data->shadow != image->match_data.shadow)
- continue;
-
- if ((flags & THEME_MATCH_ARROW_DIRECTION) &&
- match_data->arrow_direction != image->match_data.arrow_direction)
- continue;
-
- if ((flags & THEME_MATCH_ORIENTATION) &&
- match_data->orientation != image->match_data.orientation)
- continue;
-
- if ((flags & THEME_MATCH_GAP_SIDE) &&
- match_data->gap_side != image->match_data.gap_side)
- continue;
-
- if ((flags & THEME_MATCH_EXPANDER_STYLE) &&
- match_data->expander_style != image->match_data.expander_style)
- continue;
-
- if ((flags & THEME_MATCH_WINDOW_EDGE) &&
- match_data->window_edge != image->match_data.window_edge)
- continue;
-
- if (image->match_data.detail &&
- (!match_data->detail ||
- strcmp (match_data->detail, image->match_data.detail) != 0))
- continue;
-
- return image;
- }
-
- return NULL;
-}
-
-static gboolean
-draw_simple_image(GtkStyle *style,
- cairo_t *cr,
- GtkWidget *widget,
- ThemeMatchData *match_data,
- gboolean draw_center,
- gboolean allow_setbg,
- gint x,
- gint y,
- gint width,
- gint height)
-{
-
- ThemeImage *image;
-
- if (!(match_data->flags & THEME_MATCH_ORIENTATION))
- {
- match_data->flags |= THEME_MATCH_ORIENTATION;
-
- if (height > width)
- match_data->orientation = GTK_ORIENTATION_VERTICAL;
- else
- match_data->orientation = GTK_ORIENTATION_HORIZONTAL;
- }
-
- image = match_theme_image (style, match_data);
- if (image)
- {
- if (image->background)
- {
- theme_pixbuf_render (image->background, cr,
- draw_center ? COMPONENT_ALL : COMPONENT_ALL | COMPONENT_CENTER,
- FALSE,
- x, y, width, height);
- }
-
- if (image->overlay && draw_center)
- theme_pixbuf_render (image->overlay, cr, COMPONENT_ALL,
- TRUE,
- x, y, width, height);
-
- return TRUE;
- }
- else
- return FALSE;
-}
-
-static gboolean
-draw_gap_image(GtkStyle *style,
- cairo_t *cr,
- GtkWidget *widget,
- ThemeMatchData *match_data,
- gboolean draw_center,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkPositionType gap_side,
- gint gap_x,
- gint gap_width)
-{
- ThemeImage *image;
-
- if (!(match_data->flags & THEME_MATCH_ORIENTATION))
- {
- match_data->flags |= THEME_MATCH_ORIENTATION;
-
- if (height > width)
- match_data->orientation = GTK_ORIENTATION_VERTICAL;
- else
- match_data->orientation = GTK_ORIENTATION_HORIZONTAL;
- }
-
- match_data->flags |= THEME_MATCH_GAP_SIDE;
- match_data->gap_side = gap_side;
-
- image = match_theme_image (style, match_data);
- if (image)
- {
- gint thickness;
- GdkRectangle r1, r2, r3;
- GdkPixbuf *pixbuf = NULL;
- guint components = COMPONENT_ALL;
-
- if (!draw_center)
- components |= COMPONENT_CENTER;
-
- if (image->gap_start)
- pixbuf = theme_pixbuf_get_pixbuf (image->gap_start);
-
- switch (gap_side)
- {
- case GTK_POS_TOP:
- if (pixbuf)
- thickness = gdk_pixbuf_get_height (pixbuf);
- else
- thickness = style->ythickness;
-
- if (!draw_center)
- components |= COMPONENT_NORTH_WEST | COMPONENT_NORTH | COMPONENT_NORTH_EAST;
-
- r1.x = x;
- r1.y = y;
- r1.width = gap_x;
- r1.height = thickness;
- r2.x = x + gap_x;
- r2.y = y;
- r2.width = gap_width;
- r2.height = thickness;
- r3.x = x + gap_x + gap_width;
- r3.y = y;
- r3.width = width - (gap_x + gap_width);
- r3.height = thickness;
- break;
-
- case GTK_POS_BOTTOM:
- if (pixbuf)
- thickness = gdk_pixbuf_get_height (pixbuf);
- else
- thickness = style->ythickness;
-
- if (!draw_center)
- components |= COMPONENT_SOUTH_WEST | COMPONENT_SOUTH | COMPONENT_SOUTH_EAST;
-
- r1.x = x;
- r1.y = y + height - thickness;
- r1.width = gap_x;
- r1.height = thickness;
- r2.x = x + gap_x;
- r2.y = y + height - thickness;
- r2.width = gap_width;
- r2.height = thickness;
- r3.x = x + gap_x + gap_width;
- r3.y = y + height - thickness;
- r3.width = width - (gap_x + gap_width);
- r3.height = thickness;
- break;
-
- case GTK_POS_LEFT:
- if (pixbuf)
- thickness = gdk_pixbuf_get_width (pixbuf);
- else
- thickness = style->xthickness;
-
- if (!draw_center)
- components |= COMPONENT_NORTH_WEST | COMPONENT_WEST | COMPONENT_SOUTH_WEST;
-
- r1.x = x;
- r1.y = y;
- r1.width = thickness;
- r1.height = gap_x;
- r2.x = x;
- r2.y = y + gap_x;
- r2.width = thickness;
- r2.height = gap_width;
- r3.x = x;
- r3.y = y + gap_x + gap_width;
- r3.width = thickness;
- r3.height = height - (gap_x + gap_width);
- break;
-
- case GTK_POS_RIGHT:
- if (pixbuf)
- thickness = gdk_pixbuf_get_width (pixbuf);
- else
- thickness = style->xthickness;
-
- if (!draw_center)
- components |= COMPONENT_NORTH_EAST | COMPONENT_EAST | COMPONENT_SOUTH_EAST;
-
- r1.x = x + width - thickness;
- r1.y = y;
- r1.width = thickness;
- r1.height = gap_x;
- r2.x = x + width - thickness;
- r2.y = y + gap_x;
- r2.width = thickness;
- r2.height = gap_width;
- r3.x = x + width - thickness;
- r3.y = y + gap_x + gap_width;
- r3.width = thickness;
- r3.height = height - (gap_x + gap_width);
- break;
-
- default:
- g_assert_not_reached ();
- }
-
- if (image->background)
- theme_pixbuf_render (image->background,
- cr, components, FALSE,
- x, y, width, height);
- if (image->gap_start)
- theme_pixbuf_render (image->gap_start,
- cr, COMPONENT_ALL, FALSE,
- r1.x, r1.y, r1.width, r1.height);
- if (image->gap)
- theme_pixbuf_render (image->gap,
- cr, COMPONENT_ALL, FALSE,
- r2.x, r2.y, r2.width, r2.height);
- if (image->gap_end)
- theme_pixbuf_render (image->gap_end,
- cr, COMPONENT_ALL, FALSE,
- r3.x, r3.y, r3.width, r3.height);
-
- return TRUE;
- }
- else
- return FALSE;
-}
-
-static void
-draw_hline (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state,
- GtkWidget *widget,
- const gchar *detail,
- gint x1,
- gint x2,
- gint y)
-{
- ThemeImage *image;
- ThemeMatchData match_data;
-
- match_data.function = TOKEN_D_HLINE;
- match_data.detail = (gchar *)detail;
- match_data.flags = THEME_MATCH_ORIENTATION | THEME_MATCH_STATE;
- match_data.state = state;
- match_data.orientation = GTK_ORIENTATION_HORIZONTAL;
-
- image = match_theme_image (style, &match_data);
- if (image)
- {
- if (image->background)
- theme_pixbuf_render (image->background,
- cr, COMPONENT_ALL, FALSE,
- x1, y, (x2 - x1) + 1, 2);
- }
- else
- parent_class->draw_hline (style, cr, state, widget, detail,
- x1, x2, y);
-}
-
-static void
-draw_vline (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state,
- GtkWidget *widget,
- const gchar *detail,
- gint y1,
- gint y2,
- gint x)
-{
- ThemeImage *image;
- ThemeMatchData match_data;
-
- match_data.function = TOKEN_D_VLINE;
- match_data.detail = (gchar *)detail;
- match_data.flags = THEME_MATCH_ORIENTATION | THEME_MATCH_STATE;
- match_data.state = state;
- match_data.orientation = GTK_ORIENTATION_VERTICAL;
-
- image = match_theme_image (style, &match_data);
- if (image)
- {
- if (image->background)
- theme_pixbuf_render (image->background,
- cr, COMPONENT_ALL, FALSE,
- x, y1, 2, (y2 - y1) + 1);
- }
- else
- parent_class->draw_vline (style, cr, state, widget, detail,
- y1, y2, x);
-}
-
-static void
-draw_shadow(GtkStyle *style,
- cairo_t *cr,
- GtkStateType state,
- GtkShadowType shadow,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- ThemeMatchData match_data;
-
- match_data.function = TOKEN_D_SHADOW;
- match_data.detail = (gchar *)detail;
- match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
- match_data.shadow = shadow;
- match_data.state = state;
-
- if (!draw_simple_image (style, cr, widget, &match_data, FALSE, FALSE,
- x, y, width, height))
- parent_class->draw_shadow (style, cr, state, shadow, widget, detail,
- x, y, width, height);
-}
-
-/* This function makes up for some brokeness in gtkrange.c
- * where we never get the full arrow of the stepper button
- * and the type of button in a single drawing function.
- *
- * It doesn't work correctly when the scrollbar is squished
- * to the point we don't have room for full-sized steppers.
- */
-static void
-reverse_engineer_stepper_box (GtkWidget *range,
- GtkArrowType arrow_type,
- gint *x,
- gint *y,
- gint *width,
- gint *height)
-{
- gint slider_width = 14, stepper_size = 14;
- gint box_width;
- gint box_height;
-
- if (range && GTK_IS_RANGE (range))
- {
- gtk_widget_style_get (range,
- "slider_width", &slider_width,
- "stepper_size", &stepper_size,
- NULL);
- }
-
- if (arrow_type == GTK_ARROW_UP || arrow_type == GTK_ARROW_DOWN)
- {
- box_width = slider_width;
- box_height = stepper_size;
- }
- else
- {
- box_width = stepper_size;
- box_height = slider_width;
- }
-
- *x = *x - (box_width - *width) / 2;
- *y = *y - (box_height - *height) / 2;
- *width = box_width;
- *height = box_height;
-}
-
-static void
-draw_arrow (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state,
- GtkShadowType shadow,
- GtkWidget *widget,
- const gchar *detail,
- GtkArrowType arrow_direction,
- gint fill,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- ThemeMatchData match_data;
-
- if (detail &&
- (strcmp (detail, "hscrollbar") == 0 || strcmp (detail, "vscrollbar") == 0))
- {
- /* This is a hack to work around the fact that scrollbar steppers are drawn
- * as a box + arrow, so we never have
- *
- * The full bounding box of the scrollbar
- * The arrow direction
- *
- * At the same time. We simulate an extra paint function, "STEPPER", by doing
- * nothing for the box, and then here, reverse engineering the box that
- * was passed to draw box and using that
- */
- gint box_x = x;
- gint box_y = y;
- gint box_width = width;
- gint box_height = height;
-
- reverse_engineer_stepper_box (widget, arrow_direction,
- &box_x, &box_y, &box_width, &box_height);
-
- match_data.function = TOKEN_D_STEPPER;
- match_data.detail = (gchar *)detail;
- match_data.flags = (THEME_MATCH_SHADOW |
- THEME_MATCH_STATE |
- THEME_MATCH_ARROW_DIRECTION);
- match_data.shadow = shadow;
- match_data.state = state;
- match_data.arrow_direction = arrow_direction;
-
- if (draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
- box_x, box_y, box_width, box_height))
- {
- /* The theme included stepper images, we're done */
- return;
- }
-
- /* Otherwise, draw the full box, and fall through to draw the arrow
- */
- match_data.function = TOKEN_D_BOX;
- match_data.detail = (gchar *)detail;
- match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
- match_data.shadow = shadow;
- match_data.state = state;
-
- if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
- box_x, box_y, box_width, box_height))
- parent_class->draw_box (style, cr, state, shadow, widget, detail,
- box_x, box_y, box_width, box_height);
- }
-
-
- match_data.function = TOKEN_D_ARROW;
- match_data.detail = (gchar *)detail;
- match_data.flags = (THEME_MATCH_SHADOW |
- THEME_MATCH_STATE |
- THEME_MATCH_ARROW_DIRECTION);
- match_data.shadow = shadow;
- match_data.state = state;
- match_data.arrow_direction = arrow_direction;
-
- if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
- x, y, width, height))
- parent_class->draw_arrow (style, cr, state, shadow, widget, detail,
- arrow_direction, fill, x, y, width, height);
-}
-
-static void
-draw_diamond (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state,
- GtkShadowType shadow,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- ThemeMatchData match_data;
-
- match_data.function = TOKEN_D_DIAMOND;
- match_data.detail = (gchar *)detail;
- match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
- match_data.shadow = shadow;
- match_data.state = state;
-
- if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
- x, y, width, height))
- parent_class->draw_diamond (style, cr, state, shadow, widget, detail,
- x, y, width, height);
-}
-
-static void
-draw_box (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state,
- GtkShadowType shadow,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- ThemeMatchData match_data;
-
- if (detail &&
- (strcmp (detail, "hscrollbar") == 0 || strcmp (detail, "vscrollbar") == 0))
- {
- /* We handle this in draw_arrow */
- return;
- }
-
- match_data.function = TOKEN_D_BOX;
- match_data.detail = (gchar *)detail;
- match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
- match_data.shadow = shadow;
- match_data.state = state;
-
- if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
- x, y, width, height)) {
- parent_class->draw_box (style, cr, state, shadow, widget, detail,
- x, y, width, height);
- }
-}
-
-static void
-draw_flat_box (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state,
- GtkShadowType shadow,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- ThemeMatchData match_data;
-
- match_data.function = TOKEN_D_FLAT_BOX;
- match_data.detail = (gchar *)detail;
- match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
- match_data.shadow = shadow;
- match_data.state = state;
-
- if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
- x, y, width, height))
- parent_class->draw_flat_box (style, cr, state, shadow, widget, detail,
- x, y, width, height);
-}
-
-static void
-draw_check (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state,
- GtkShadowType shadow,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- ThemeMatchData match_data;
-
- match_data.function = TOKEN_D_CHECK;
- match_data.detail = (gchar *)detail;
- match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
- match_data.shadow = shadow;
- match_data.state = state;
-
- if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
- x, y, width, height))
- parent_class->draw_check (style, cr, state, shadow, widget, detail,
- x, y, width, height);
-}
-
-static void
-draw_option (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state,
- GtkShadowType shadow,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- ThemeMatchData match_data;
-
- match_data.function = TOKEN_D_OPTION;
- match_data.detail = (gchar *)detail;
- match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
- match_data.shadow = shadow;
- match_data.state = state;
-
- if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
- x, y, width, height))
- parent_class->draw_option (style, cr, state, shadow, widget, detail,
- x, y, width, height);
-}
-
-static void
-draw_tab (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state,
- GtkShadowType shadow,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- ThemeMatchData match_data;
-
- match_data.function = TOKEN_D_TAB;
- match_data.detail = (gchar *)detail;
- match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
- match_data.shadow = shadow;
- match_data.state = state;
-
- if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
- x, y, width, height))
- parent_class->draw_tab (style, cr, state, shadow, widget, detail,
- x, y, width, height);
-}
-
-static void
-draw_shadow_gap (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state,
- GtkShadowType shadow,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkPositionType gap_side,
- gint gap_x,
- gint gap_width)
-{
- ThemeMatchData match_data;
-
- match_data.function = TOKEN_D_SHADOW_GAP;
- match_data.detail = (gchar *)detail;
- match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
- match_data.flags = (THEME_MATCH_SHADOW |
- THEME_MATCH_STATE |
- THEME_MATCH_ORIENTATION);
- match_data.shadow = shadow;
- match_data.state = state;
-
- if (!draw_gap_image (style, cr, widget, &match_data, FALSE,
- x, y, width, height, gap_side, gap_x, gap_width))
- parent_class->draw_shadow_gap (style, cr, state, shadow, widget, detail,
- x, y, width, height, gap_side, gap_x, gap_width);
-}
-
-static void
-draw_box_gap (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state,
- GtkShadowType shadow,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkPositionType gap_side,
- gint gap_x,
- gint gap_width)
-{
- ThemeMatchData match_data;
-
- match_data.function = TOKEN_D_BOX_GAP;
- match_data.detail = (gchar *)detail;
- match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
- match_data.flags = (THEME_MATCH_SHADOW |
- THEME_MATCH_STATE |
- THEME_MATCH_ORIENTATION);
- match_data.shadow = shadow;
- match_data.state = state;
-
- if (!draw_gap_image (style, cr, widget, &match_data, TRUE,
- x, y, width, height, gap_side, gap_x, gap_width))
- parent_class->draw_box_gap (style, cr, state, shadow, widget, detail,
- x, y, width, height, gap_side, gap_x, gap_width);
-}
-
-static void
-draw_extension (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state,
- GtkShadowType shadow,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkPositionType gap_side)
-{
- ThemeMatchData match_data;
-
- match_data.function = TOKEN_D_EXTENSION;
- match_data.detail = (gchar *)detail;
- match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE | THEME_MATCH_GAP_SIDE;
- match_data.shadow = shadow;
- match_data.state = state;
- match_data.gap_side = gap_side;
-
- if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
- x, y, width, height))
- parent_class->draw_extension (style, cr, state, shadow, widget, detail,
- x, y, width, height, gap_side);
-}
-
-static void
-draw_focus (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state_type,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- ThemeMatchData match_data;
-
- match_data.function = TOKEN_D_FOCUS;
- match_data.detail = (gchar *)detail;
- match_data.flags = 0;
-
- if (!draw_simple_image (style, cr, widget, &match_data, TRUE, FALSE,
- x, y, width, height))
- parent_class->draw_focus (style, cr, state_type, widget, detail,
- x, y, width, height);
-}
-
-static void
-draw_slider (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state,
- GtkShadowType shadow,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkOrientation orientation)
-{
- ThemeMatchData match_data;
-
- match_data.function = TOKEN_D_SLIDER;
- match_data.detail = (gchar *)detail;
- match_data.flags = (THEME_MATCH_SHADOW |
- THEME_MATCH_STATE |
- THEME_MATCH_ORIENTATION);
- match_data.shadow = shadow;
- match_data.state = state;
- match_data.orientation = orientation;
-
- if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
- x, y, width, height))
- parent_class->draw_slider (style, cr, state, shadow, widget, detail,
- x, y, width, height, orientation);
-}
-
-
-static void
-draw_handle (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state,
- GtkShadowType shadow,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkOrientation orientation)
-{
- ThemeMatchData match_data;
-
- match_data.function = TOKEN_D_HANDLE;
- match_data.detail = (gchar *)detail;
- match_data.flags = (THEME_MATCH_SHADOW |
- THEME_MATCH_STATE |
- THEME_MATCH_ORIENTATION);
- match_data.shadow = shadow;
- match_data.state = state;
- match_data.orientation = orientation;
-
- if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
- x, y, width, height))
- parent_class->draw_handle (style, cr, state, shadow, widget, detail,
- x, y, width, height, orientation);
-}
-
-static void
-draw_expander (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- GtkExpanderStyle expander_style)
-{
-#define DEFAULT_EXPANDER_SIZE 12
-
- ThemeMatchData match_data;
- gint expander_size;
- gint radius;
-
- if (widget &&
- gtk_widget_class_find_style_property (GTK_WIDGET_GET_CLASS (widget),
- "expander-size"))
- {
- gtk_widget_style_get (widget,
- "expander-size", &expander_size,
- NULL);
- }
- else
- expander_size = DEFAULT_EXPANDER_SIZE;
-
- radius = expander_size/2;
-
- match_data.function = TOKEN_D_EXPANDER;
- match_data.detail = (gchar *)detail;
- match_data.flags = (THEME_MATCH_STATE |
- THEME_MATCH_EXPANDER_STYLE);
- match_data.state = state;
- match_data.expander_style = expander_style;
-
- if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
- x - radius, y - radius, expander_size, expander_size))
- parent_class->draw_expander (style, cr, state, widget, detail,
- x, y, expander_style);
-}
-
-static void
-draw_resize_grip (GtkStyle *style,
- cairo_t *cr,
- GtkStateType state,
- GtkWidget *widget,
- const gchar *detail,
- GdkWindowEdge edge,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- ThemeMatchData match_data;
-
- match_data.function = TOKEN_D_RESIZE_GRIP;
- match_data.detail = (gchar *)detail;
- match_data.flags = (THEME_MATCH_STATE |
- THEME_MATCH_WINDOW_EDGE);
- match_data.state = state;
- match_data.window_edge = edge;
-
- if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
- x, y, width, height))
- parent_class->draw_resize_grip (style, cr, state, widget, detail,
- edge, x, y, width, height);
-}
-
-GType pixbuf_type_style = 0;
-
-void
-pixbuf_style_register_type (GTypeModule *module)
-{
- const GTypeInfo object_info =
- {
- sizeof (PixbufStyleClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) pixbuf_style_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (PixbufStyle),
- 0, /* n_preallocs */
- (GInstanceInitFunc) pixbuf_style_init,
- };
-
- pixbuf_type_style = g_type_module_register_type (module,
- GTK_TYPE_STYLE,
- "PixbufStyle",
- &object_info, 0);
-}
-
-static void
-pixbuf_style_init (PixbufStyle *style)
-{
-}
-
-static void
-pixbuf_style_class_init (PixbufStyleClass *klass)
-{
- GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- style_class->draw_hline = draw_hline;
- style_class->draw_vline = draw_vline;
- style_class->draw_shadow = draw_shadow;
- style_class->draw_arrow = draw_arrow;
- style_class->draw_diamond = draw_diamond;
- style_class->draw_box = draw_box;
- style_class->draw_flat_box = draw_flat_box;
- style_class->draw_check = draw_check;
- style_class->draw_option = draw_option;
- style_class->draw_tab = draw_tab;
- style_class->draw_shadow_gap = draw_shadow_gap;
- style_class->draw_box_gap = draw_box_gap;
- style_class->draw_extension = draw_extension;
- style_class->draw_focus = draw_focus;
- style_class->draw_slider = draw_slider;
- style_class->draw_handle = draw_handle;
- style_class->draw_expander = draw_expander;
- style_class->draw_resize_grip = draw_resize_grip;
-}
+++ /dev/null
-/* GTK+ Pixbuf Engine
- * Copyright (C) 1998-2000 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Written by Owen Taylor <otaylor@redhat.com>, based on code by
- * Carsten Haitzler <raster@rasterman.com>
- */
-
-#include "pixbuf.h"
-#include "pixbuf-style.h"
-#include "pixbuf-rc-style.h"
-#include <gmodule.h>
-
-G_MODULE_EXPORT void
-theme_init (GTypeModule *module)
-{
- pixbuf_rc_style_register_type (module);
- pixbuf_style_register_type (module);
-}
-
-G_MODULE_EXPORT void
-theme_exit (void)
-{
-}
-
-G_MODULE_EXPORT GtkRcStyle *
-theme_create_rc_style (void)
-{
- return g_object_new (PIXBUF_TYPE_RC_STYLE, NULL);
-}
-
-/* The following function will be called by GTK+ when the module
- * is loaded and checks to see if we are compatible with the
- * version of GTK+ that loads us.
- */
-G_MODULE_EXPORT const gchar* g_module_check_init (GModule *module);
-const gchar*
-g_module_check_init (GModule *module)
-{
- return gtk_check_version (GTK_MAJOR_VERSION,
- GTK_MINOR_VERSION,
- GTK_MICRO_VERSION - GTK_INTERFACE_AGE);
-}
+++ /dev/null
-/* GTK+ Pixbuf Engine
- * Copyright (C) 1998-2000 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Written by Owen Taylor <otaylor@redhat.com>, based on code by
- * Carsten Haitzler <raster@rasterman.com>
- */
-
-#include "pixbuf.h"
-#include "pixbuf-style.h"
-#include "pixbuf-rc-style.h"
-
-static void pixbuf_rc_style_init (PixbufRcStyle *style);
-static void pixbuf_rc_style_class_init (PixbufRcStyleClass *klass);
-static void pixbuf_rc_style_finalize (GObject *object);
-static guint pixbuf_rc_style_parse (GtkRcStyle *rc_style,
- GtkSettings *settings,
- GScanner *scanner);
-static void pixbuf_rc_style_merge (GtkRcStyle *dest,
- GtkRcStyle *src);
-static GtkStyle *pixbuf_rc_style_create_style (GtkRcStyle *rc_style);
-
-static void theme_image_unref (ThemeImage *data);
-
-static const struct
- {
- gchar *name;
- guint token;
- }
-theme_symbols[] =
-{
- { "image", TOKEN_IMAGE },
- { "function", TOKEN_FUNCTION },
- { "file", TOKEN_FILE },
- { "stretch", TOKEN_STRETCH },
- { "recolorable", TOKEN_RECOLORABLE },
- { "border", TOKEN_BORDER },
- { "detail", TOKEN_DETAIL },
- { "state", TOKEN_STATE },
- { "shadow", TOKEN_SHADOW },
- { "gap_side", TOKEN_GAP_SIDE },
- { "gap_file", TOKEN_GAP_FILE },
- { "gap_border", TOKEN_GAP_BORDER },
- { "gap_start_file", TOKEN_GAP_START_FILE },
- { "gap_start_border", TOKEN_GAP_START_BORDER },
- { "gap_end_file", TOKEN_GAP_END_FILE },
- { "gap_end_border", TOKEN_GAP_END_BORDER },
- { "overlay_file", TOKEN_OVERLAY_FILE },
- { "overlay_border", TOKEN_OVERLAY_BORDER },
- { "overlay_stretch", TOKEN_OVERLAY_STRETCH },
- { "arrow_direction", TOKEN_ARROW_DIRECTION },
- { "orientation", TOKEN_ORIENTATION },
- { "expander_style", TOKEN_EXPANDER_STYLE },
- { "window_edge", TOKEN_WINDOW_EDGE },
-
- { "HLINE", TOKEN_D_HLINE },
- { "VLINE", TOKEN_D_VLINE },
- { "SHADOW", TOKEN_D_SHADOW },
- { "POLYGON", TOKEN_D_POLYGON },
- { "ARROW", TOKEN_D_ARROW },
- { "DIAMOND", TOKEN_D_DIAMOND },
- { "OVAL", TOKEN_D_OVAL },
- { "STRING", TOKEN_D_STRING },
- { "BOX", TOKEN_D_BOX },
- { "FLAT_BOX", TOKEN_D_FLAT_BOX },
- { "CHECK", TOKEN_D_CHECK },
- { "OPTION", TOKEN_D_OPTION },
- { "CROSS", TOKEN_D_CROSS },
- { "RAMP", TOKEN_D_RAMP },
- { "TAB", TOKEN_D_TAB },
- { "SHADOW_GAP", TOKEN_D_SHADOW_GAP },
- { "BOX_GAP", TOKEN_D_BOX_GAP },
- { "EXTENSION", TOKEN_D_EXTENSION },
- { "FOCUS", TOKEN_D_FOCUS },
- { "SLIDER", TOKEN_D_SLIDER },
- { "ENTRY", TOKEN_D_ENTRY },
- { "HANDLE", TOKEN_D_HANDLE },
- { "STEPPER", TOKEN_D_STEPPER },
- { "EXPANDER", TOKEN_D_EXPANDER },
- { "RESIZE_GRIP", TOKEN_D_RESIZE_GRIP },
-
- { "TRUE", TOKEN_TRUE },
- { "FALSE", TOKEN_FALSE },
-
- { "TOP", TOKEN_TOP },
- { "UP", TOKEN_UP },
- { "BOTTOM", TOKEN_BOTTOM },
- { "DOWN", TOKEN_DOWN },
- { "LEFT", TOKEN_LEFT },
- { "RIGHT", TOKEN_RIGHT },
-
- { "NORMAL", TOKEN_NORMAL },
- { "ACTIVE", TOKEN_ACTIVE },
- { "PRELIGHT", TOKEN_PRELIGHT },
- { "SELECTED", TOKEN_SELECTED },
- { "INSENSITIVE", TOKEN_INSENSITIVE },
-
- { "NONE", TOKEN_NONE },
- { "IN", TOKEN_IN },
- { "OUT", TOKEN_OUT },
- { "ETCHED_IN", TOKEN_ETCHED_IN },
- { "ETCHED_OUT", TOKEN_ETCHED_OUT },
-
- { "HORIZONTAL", TOKEN_HORIZONTAL },
- { "VERTICAL", TOKEN_VERTICAL },
-
- { "COLLAPSED", TOKEN_COLLAPSED },
- { "SEMI_COLLAPSED", TOKEN_SEMI_COLLAPSED },
- { "SEMI_EXPANDED", TOKEN_SEMI_EXPANDED },
- { "EXPANDED", TOKEN_EXPANDED },
-
- { "NORTH_WEST", TOKEN_NORTH_WEST },
- { "NORTH", TOKEN_NORTH },
- { "NORTH_EAST", TOKEN_NORTH_EAST },
- { "WEST", TOKEN_WEST },
- { "EAST", TOKEN_EAST },
- { "SOUTH_WEST", TOKEN_SOUTH_WEST },
- { "SOUTH", TOKEN_SOUTH },
- { "SOUTH_EAST", TOKEN_SOUTH_EAST }
-};
-
-static GtkRcStyleClass *parent_class;
-
-GType pixbuf_type_rc_style = 0;
-
-void
-pixbuf_rc_style_register_type (GTypeModule *module)
-{
- const GTypeInfo object_info =
- {
- sizeof (PixbufRcStyleClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) pixbuf_rc_style_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (PixbufRcStyle),
- 0, /* n_preallocs */
- (GInstanceInitFunc) pixbuf_rc_style_init,
- };
-
- pixbuf_type_rc_style = g_type_module_register_type (module,
- GTK_TYPE_RC_STYLE,
- "PixbufRcStyle",
- &object_info, 0);
-}
-
-static void
-pixbuf_rc_style_init (PixbufRcStyle *style)
-{
-}
-
-static void
-pixbuf_rc_style_class_init (PixbufRcStyleClass *klass)
-{
- GtkRcStyleClass *rc_style_class = GTK_RC_STYLE_CLASS (klass);
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- rc_style_class->parse = pixbuf_rc_style_parse;
- rc_style_class->merge = pixbuf_rc_style_merge;
- rc_style_class->create_style = pixbuf_rc_style_create_style;
-
- object_class->finalize = pixbuf_rc_style_finalize;
-}
-
-static void
-pixbuf_rc_style_finalize (GObject *object)
-{
- PixbufRcStyle *rc_style = PIXBUF_RC_STYLE (object);
-
- g_list_free_full (rc_style->img_list, theme_image_unref);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static guint
-theme_parse_file(GtkSettings *settings,
- GScanner *scanner,
- ThemePixbuf **theme_pb)
-{
- guint token;
- gchar *pixmap;
-
- /* Skip 'blah_file' */
- token = g_scanner_get_next_token(scanner);
-
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
- return G_TOKEN_EQUAL_SIGN;
-
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_STRING)
- return G_TOKEN_STRING;
-
- if (!*theme_pb)
- *theme_pb = theme_pixbuf_new ();
-
- pixmap = gtk_rc_find_pixmap_in_path(settings, scanner, scanner->value.v_string);
- if (pixmap)
- {
- theme_pixbuf_set_filename (*theme_pb, pixmap);
- g_free (pixmap);
- }
-
- return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_border (GScanner *scanner,
- ThemePixbuf **theme_pb)
-{
- guint token;
- gint left, right, top, bottom;
-
- /* Skip 'blah_border' */
- token = g_scanner_get_next_token(scanner);
-
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
- return G_TOKEN_EQUAL_SIGN;
-
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_LEFT_CURLY)
- return G_TOKEN_LEFT_CURLY;
-
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_INT)
- return G_TOKEN_INT;
- left = scanner->value.v_int;
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_COMMA)
- return G_TOKEN_COMMA;
-
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_INT)
- return G_TOKEN_INT;
- right = scanner->value.v_int;
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_COMMA)
- return G_TOKEN_COMMA;
-
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_INT)
- return G_TOKEN_INT;
- top = scanner->value.v_int;
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_COMMA)
- return G_TOKEN_COMMA;
-
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_INT)
- return G_TOKEN_INT;
- bottom = scanner->value.v_int;
-
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_RIGHT_CURLY)
- return G_TOKEN_RIGHT_CURLY;
-
- if (!*theme_pb)
- *theme_pb = theme_pixbuf_new ();
-
- theme_pixbuf_set_border (*theme_pb, left, right, top, bottom);
-
- return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_stretch(GScanner *scanner,
- ThemePixbuf **theme_pb)
-{
- guint token;
- gboolean stretch;
-
- /* Skip 'blah_stretch' */
- token = g_scanner_get_next_token(scanner);
-
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
- return G_TOKEN_EQUAL_SIGN;
-
- token = g_scanner_get_next_token(scanner);
- if (token == TOKEN_TRUE)
- stretch = TRUE;
- else if (token == TOKEN_FALSE)
- stretch = FALSE;
- else
- return TOKEN_TRUE;
-
- if (!*theme_pb)
- *theme_pb = theme_pixbuf_new ();
-
- theme_pixbuf_set_stretch (*theme_pb, stretch);
-
- return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_recolorable(GScanner * scanner,
- ThemeImage * data)
-{
- guint token;
-
- token = g_scanner_get_next_token(scanner);
- if (token != TOKEN_RECOLORABLE)
- return TOKEN_RECOLORABLE;
-
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
- return G_TOKEN_EQUAL_SIGN;
-
- token = g_scanner_get_next_token(scanner);
- if (token == TOKEN_TRUE)
- data->recolorable = 1;
- else if (token == TOKEN_FALSE)
- data->recolorable = 0;
- else
- return TOKEN_TRUE;
-
- return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_function(GScanner * scanner,
- ThemeImage *data)
-{
- guint token;
-
- token = g_scanner_get_next_token(scanner);
- if (token != TOKEN_FUNCTION)
- return TOKEN_FUNCTION;
-
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
- return G_TOKEN_EQUAL_SIGN;
-
- token = g_scanner_get_next_token(scanner);
- if ((token >= TOKEN_D_HLINE) && (token <= TOKEN_D_RESIZE_GRIP))
- data->match_data.function = token;
-
- return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_detail(GScanner * scanner,
- ThemeImage * data)
-{
- guint token;
-
- token = g_scanner_get_next_token(scanner);
- if (token != TOKEN_DETAIL)
- return TOKEN_DETAIL;
-
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
- return G_TOKEN_EQUAL_SIGN;
-
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_STRING)
- return G_TOKEN_STRING;
-
- g_free (data->match_data.detail);
-
- data->match_data.detail = g_strdup(scanner->value.v_string);
-
- return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_state(GScanner * scanner,
- ThemeImage * data)
-{
- guint token;
-
- token = g_scanner_get_next_token(scanner);
- if (token != TOKEN_STATE)
- return TOKEN_STATE;
-
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
- return G_TOKEN_EQUAL_SIGN;
-
- token = g_scanner_get_next_token(scanner);
- if (token == TOKEN_NORMAL)
- data->match_data.state = GTK_STATE_NORMAL;
- else if (token == TOKEN_ACTIVE)
- data->match_data.state = GTK_STATE_ACTIVE;
- else if (token == TOKEN_PRELIGHT)
- data->match_data.state = GTK_STATE_PRELIGHT;
- else if (token == TOKEN_SELECTED)
- data->match_data.state = GTK_STATE_SELECTED;
- else if (token == TOKEN_INSENSITIVE)
- data->match_data.state = GTK_STATE_INSENSITIVE;
- else
- return TOKEN_NORMAL;
-
- data->match_data.flags |= THEME_MATCH_STATE;
-
- return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_shadow(GScanner * scanner,
- ThemeImage * data)
-{
- guint token;
-
- token = g_scanner_get_next_token(scanner);
- if (token != TOKEN_SHADOW)
- return TOKEN_SHADOW;
-
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
- return G_TOKEN_EQUAL_SIGN;
-
- token = g_scanner_get_next_token(scanner);
- if (token == TOKEN_NONE)
- data->match_data.shadow = GTK_SHADOW_NONE;
- else if (token == TOKEN_IN)
- data->match_data.shadow = GTK_SHADOW_IN;
- else if (token == TOKEN_OUT)
- data->match_data.shadow = GTK_SHADOW_OUT;
- else if (token == TOKEN_ETCHED_IN)
- data->match_data.shadow = GTK_SHADOW_ETCHED_IN;
- else if (token == TOKEN_ETCHED_OUT)
- data->match_data.shadow = GTK_SHADOW_ETCHED_OUT;
- else
- return TOKEN_NONE;
-
- data->match_data.flags |= THEME_MATCH_SHADOW;
-
- return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_arrow_direction(GScanner * scanner,
- ThemeImage * data)
-{
- guint token;
-
- token = g_scanner_get_next_token(scanner);
- if (token != TOKEN_ARROW_DIRECTION)
- return TOKEN_ARROW_DIRECTION;
-
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
- return G_TOKEN_EQUAL_SIGN;
-
- token = g_scanner_get_next_token(scanner);
- if (token == TOKEN_UP)
- data->match_data.arrow_direction = GTK_ARROW_UP;
- else if (token == TOKEN_DOWN)
- data->match_data.arrow_direction = GTK_ARROW_DOWN;
- else if (token == TOKEN_LEFT)
- data->match_data.arrow_direction = GTK_ARROW_LEFT;
- else if (token == TOKEN_RIGHT)
- data->match_data.arrow_direction = GTK_ARROW_RIGHT;
- else
- return TOKEN_UP;
-
- data->match_data.flags |= THEME_MATCH_ARROW_DIRECTION;
-
- return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_gap_side(GScanner * scanner,
- ThemeImage * data)
-{
- guint token;
-
- token = g_scanner_get_next_token(scanner);
- if (token != TOKEN_GAP_SIDE)
- return TOKEN_GAP_SIDE;
-
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
- return G_TOKEN_EQUAL_SIGN;
-
- token = g_scanner_get_next_token(scanner);
-
- if (token == TOKEN_TOP)
- data->match_data.gap_side = GTK_POS_TOP;
- else if (token == TOKEN_BOTTOM)
- data->match_data.gap_side = GTK_POS_BOTTOM;
- else if (token == TOKEN_LEFT)
- data->match_data.gap_side = GTK_POS_LEFT;
- else if (token == TOKEN_RIGHT)
- data->match_data.gap_side = GTK_POS_RIGHT;
- else
- return TOKEN_TOP;
-
- data->match_data.flags |= THEME_MATCH_GAP_SIDE;
-
- return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_orientation(GScanner * scanner,
- ThemeImage * data)
-{
- guint token;
-
- token = g_scanner_get_next_token(scanner);
- if (token != TOKEN_ORIENTATION)
- return TOKEN_ORIENTATION;
-
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
- return G_TOKEN_EQUAL_SIGN;
-
- token = g_scanner_get_next_token(scanner);
-
- if (token == TOKEN_HORIZONTAL)
- data->match_data.orientation = GTK_ORIENTATION_HORIZONTAL;
- else if (token == TOKEN_VERTICAL)
- data->match_data.orientation = GTK_ORIENTATION_VERTICAL;
- else
- return TOKEN_HORIZONTAL;
-
- data->match_data.flags |= THEME_MATCH_ORIENTATION;
-
- return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_expander_style(GScanner * scanner,
- ThemeImage * data)
-{
- guint token;
-
- token = g_scanner_get_next_token(scanner);
- if (token != TOKEN_EXPANDER_STYLE)
- return TOKEN_EXPANDER_STYLE;
-
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
- return G_TOKEN_EQUAL_SIGN;
-
- token = g_scanner_get_next_token(scanner);
- if (token == TOKEN_COLLAPSED)
- data->match_data.expander_style = GTK_EXPANDER_COLLAPSED;
- else if (token == TOKEN_SEMI_COLLAPSED)
- data->match_data.expander_style = GTK_EXPANDER_SEMI_COLLAPSED;
- else if (token == TOKEN_SEMI_EXPANDED)
- data->match_data.expander_style = GTK_EXPANDER_SEMI_EXPANDED;
- else if (token == TOKEN_EXPANDED)
- data->match_data.expander_style = GTK_EXPANDER_EXPANDED;
- else
- return TOKEN_COLLAPSED;
-
- data->match_data.flags |= THEME_MATCH_EXPANDER_STYLE;
-
- return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_window_edge(GScanner * scanner,
- ThemeImage * data)
-{
- guint token;
-
- token = g_scanner_get_next_token(scanner);
- if (token != TOKEN_WINDOW_EDGE)
- return TOKEN_WINDOW_EDGE;
-
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
- return G_TOKEN_EQUAL_SIGN;
-
- token = g_scanner_get_next_token(scanner);
- if (token == TOKEN_NORTH_WEST)
- data->match_data.window_edge = GDK_WINDOW_EDGE_NORTH_WEST;
- else if (token == TOKEN_NORTH)
- data->match_data.window_edge = GDK_WINDOW_EDGE_NORTH;
- else if (token == TOKEN_NORTH_EAST)
- data->match_data.window_edge = GDK_WINDOW_EDGE_NORTH_EAST;
- else if (token == TOKEN_WEST)
- data->match_data.window_edge = GDK_WINDOW_EDGE_WEST;
- else if (token == TOKEN_EAST)
- data->match_data.window_edge = GDK_WINDOW_EDGE_EAST;
- else if (token == TOKEN_SOUTH_WEST)
- data->match_data.window_edge = GDK_WINDOW_EDGE_SOUTH_WEST;
- else if (token == TOKEN_SOUTH)
- data->match_data.window_edge = GDK_WINDOW_EDGE_SOUTH;
- else if (token == TOKEN_SOUTH_EAST)
- data->match_data.window_edge = GDK_WINDOW_EDGE_SOUTH_EAST;
- else
- return TOKEN_NORTH_WEST;
-
- data->match_data.flags |= THEME_MATCH_WINDOW_EDGE;
-
- return G_TOKEN_NONE;
-}
-
-static void
-theme_image_ref (ThemeImage *data)
-{
- data->refcount++;
-}
-
-static void
-theme_image_unref (ThemeImage *data)
-{
- data->refcount--;
- if (data->refcount == 0)
- {
- g_free (data->match_data.detail);
- theme_pixbuf_destroy (data->background);
- theme_pixbuf_destroy (data->overlay);
- theme_pixbuf_destroy (data->gap_start);
- theme_pixbuf_destroy (data->gap_end);
- theme_pixbuf_destroy (data->gap);
- g_free (data);
- }
-}
-
-static inline void
-clear_theme_pixbuf_and_warn (ThemePixbuf **theme_pb,
- GScanner *scanner,
- const char *message)
-{
- theme_clear_pixbuf (theme_pb);
- g_scanner_warn (scanner, message);
-}
-
-static guint
-theme_parse_image(GtkSettings *settings,
- GScanner *scanner,
- PixbufRcStyle *pixbuf_style,
- ThemeImage **data_return)
-{
- guint token;
- ThemeImage *data;
-
- data = NULL;
- token = g_scanner_get_next_token(scanner);
- if (token != TOKEN_IMAGE)
- return TOKEN_IMAGE;
-
- token = g_scanner_get_next_token(scanner);
- if (token != G_TOKEN_LEFT_CURLY)
- return G_TOKEN_LEFT_CURLY;
-
- data = g_malloc(sizeof(ThemeImage));
-
- data->refcount = 1;
-
- data->background = NULL;
- data->overlay = NULL;
- data->gap_start = NULL;
- data->gap = NULL;
- data->gap_end = NULL;
-
- data->recolorable = FALSE;
-
- data->match_data.function = 0;
- data->match_data.detail = NULL;
- data->match_data.flags = 0;
-
- token = g_scanner_peek_next_token(scanner);
- while (token != G_TOKEN_RIGHT_CURLY)
- {
- switch (token)
- {
- case TOKEN_FUNCTION:
- token = theme_parse_function(scanner, data);
- break;
- case TOKEN_RECOLORABLE:
- token = theme_parse_recolorable(scanner, data);
- break;
- case TOKEN_DETAIL:
- token = theme_parse_detail(scanner, data);
- break;
- case TOKEN_STATE:
- token = theme_parse_state(scanner, data);
- break;
- case TOKEN_SHADOW:
- token = theme_parse_shadow(scanner, data);
- break;
- case TOKEN_GAP_SIDE:
- token = theme_parse_gap_side(scanner, data);
- break;
- case TOKEN_ARROW_DIRECTION:
- token = theme_parse_arrow_direction(scanner, data);
- break;
- case TOKEN_ORIENTATION:
- token = theme_parse_orientation(scanner, data);
- break;
- case TOKEN_FILE:
- token = theme_parse_file(settings, scanner, &data->background);
- break;
- case TOKEN_BORDER:
- token = theme_parse_border(scanner, &data->background);
- break;
- case TOKEN_STRETCH:
- token = theme_parse_stretch(scanner, &data->background);
- break;
- case TOKEN_GAP_FILE:
- token = theme_parse_file(settings, scanner, &data->gap);
- break;
- case TOKEN_GAP_BORDER:
- token = theme_parse_border(scanner, &data->gap);
- break;
- case TOKEN_GAP_START_FILE:
- token = theme_parse_file(settings, scanner, &data->gap_start);
- break;
- case TOKEN_GAP_START_BORDER:
- token = theme_parse_border(scanner, &data->gap_start);
- break;
- case TOKEN_GAP_END_FILE:
- token = theme_parse_file(settings, scanner, &data->gap_end);
- break;
- case TOKEN_GAP_END_BORDER:
- token = theme_parse_border(scanner, &data->gap_end);
- break;
- case TOKEN_OVERLAY_FILE:
- token = theme_parse_file(settings, scanner, &data->overlay);
- break;
- case TOKEN_OVERLAY_BORDER:
- token = theme_parse_border(scanner, &data->overlay);
- break;
- case TOKEN_OVERLAY_STRETCH:
- token = theme_parse_stretch(scanner, &data->overlay);
- break;
- case TOKEN_EXPANDER_STYLE:
- token = theme_parse_expander_style(scanner, data);
- break;
- case TOKEN_WINDOW_EDGE:
- token = theme_parse_window_edge(scanner, data);
- break;
- default:
- g_scanner_get_next_token(scanner);
- token = G_TOKEN_RIGHT_CURLY;
- break;
- }
- if (token != G_TOKEN_NONE)
- {
- /* error - cleanup for exit */
- theme_image_unref (data);
- *data_return = NULL;
- return token;
- }
- token = g_scanner_peek_next_token(scanner);
- }
-
- token = g_scanner_get_next_token(scanner);
-
- if (data->background && !data->background->filename)
- clear_theme_pixbuf_and_warn (&data->background, scanner, "Background image options specified without filename");
-
- if (data->overlay && !data->overlay->filename)
- clear_theme_pixbuf_and_warn (&data->overlay, scanner, "Overlay image options specified without filename");
-
- if (data->gap && !data->gap->filename)
- clear_theme_pixbuf_and_warn (&data->gap, scanner, "Gap image options specified without filename");
-
- if (data->gap_start && !data->gap_start->filename)
- clear_theme_pixbuf_and_warn (&data->gap_start, scanner, "Gap start image options specified without filename");
-
- if (data->gap_end && !data->gap_end->filename)
- clear_theme_pixbuf_and_warn (&data->gap_end, scanner, "Gap end image options specified without filename");
-
- if (token != G_TOKEN_RIGHT_CURLY)
- {
- /* error - cleanup for exit */
- theme_image_unref (data);
- *data_return = NULL;
- return G_TOKEN_RIGHT_CURLY;
- }
-
- /* everything is fine now - insert yer cruft */
- *data_return = data;
- return G_TOKEN_NONE;
-}
-
-static guint
-pixbuf_rc_style_parse (GtkRcStyle *rc_style,
- GtkSettings *settings,
- GScanner *scanner)
-
-{
- static GQuark scope_id = 0;
- PixbufRcStyle *pixbuf_style = PIXBUF_RC_STYLE (rc_style);
-
- guint old_scope;
- guint token;
- gint i;
- ThemeImage *img;
-
- /* Set up a new scope in this scanner. */
-
- if (!scope_id)
- scope_id = g_quark_from_string("pixbuf_theme_engine");
-
- /* If we bail out due to errors, we *don't* reset the scope, so the
- * error messaging code can make sense of our tokens.
- */
- old_scope = g_scanner_set_scope(scanner, scope_id);
-
- /* Now check if we already added our symbols to this scope
- * (in some previous call to theme_parse_rc_style for the
- * same scanner.
- */
-
- if (!g_scanner_lookup_symbol(scanner, theme_symbols[0].name))
- {
- for (i = 0; i < G_N_ELEMENTS (theme_symbols); i++)
- g_scanner_scope_add_symbol(scanner, scope_id,
- theme_symbols[i].name,
- GINT_TO_POINTER(theme_symbols[i].token));
- }
-
- /* We're ready to go, now parse the top level */
-
- token = g_scanner_peek_next_token(scanner);
- while (token != G_TOKEN_RIGHT_CURLY)
- {
- switch (token)
- {
- case TOKEN_IMAGE:
- img = NULL;
- token = theme_parse_image(settings, scanner, pixbuf_style, &img);
- break;
- default:
- g_scanner_get_next_token(scanner);
- token = G_TOKEN_RIGHT_CURLY;
- break;
- }
-
- if (token != G_TOKEN_NONE)
- return token;
- else
- pixbuf_style->img_list = g_list_append(pixbuf_style->img_list, img);
-
- token = g_scanner_peek_next_token(scanner);
- }
-
- g_scanner_get_next_token(scanner);
-
- g_scanner_set_scope(scanner, old_scope);
-
- return G_TOKEN_NONE;
-}
-
-static void
-pixbuf_rc_style_merge (GtkRcStyle *dest,
- GtkRcStyle *src)
-{
- if (PIXBUF_IS_RC_STYLE (src))
- {
- PixbufRcStyle *pixbuf_dest = PIXBUF_RC_STYLE (dest);
- PixbufRcStyle *pixbuf_src = PIXBUF_RC_STYLE (src);
- GList *tmp_list1, *tmp_list2;
-
- if (pixbuf_src->img_list)
- {
- /* Copy src image list and append to dest image list */
-
- tmp_list2 = g_list_last (pixbuf_dest->img_list);
- tmp_list1 = pixbuf_src->img_list;
-
- while (tmp_list1)
- {
- if (tmp_list2)
- {
- tmp_list2->next = g_list_alloc();
- tmp_list2->next->data = tmp_list1->data;
- tmp_list2->next->prev = tmp_list2;
-
- tmp_list2 = tmp_list2->next;
- }
- else
- {
- pixbuf_dest->img_list = g_list_append (NULL, tmp_list1->data);
- tmp_list2 = pixbuf_dest->img_list;
- }
-
- theme_image_ref (tmp_list1->data);
- tmp_list1 = tmp_list1->next;
- }
- }
- }
-
- parent_class->merge (dest, src);
-}
-
-/* Create an empty style suitable to this RC style
- */
-static GtkStyle *
-pixbuf_rc_style_create_style (GtkRcStyle *rc_style)
-{
- return g_object_new (PIXBUF_TYPE_STYLE, NULL);
-}
-
+++ /dev/null
-/* GTK+ Pixbuf Engine
- * Copyright (C) 1998-2000 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Written by Owen Taylor <otaylor@redhat.com>, based on code by
- * Carsten Haitzler <raster@rasterman.com>
- */
-
-#include <gtk/gtk.h>
-
-typedef struct _PixbufRcStyle PixbufRcStyle;
-typedef struct _PixbufRcStyleClass PixbufRcStyleClass;
-
-extern G_GNUC_INTERNAL GType pixbuf_type_rc_style;
-
-#define PIXBUF_TYPE_RC_STYLE pixbuf_type_rc_style
-#define PIXBUF_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PIXBUF_TYPE_RC_STYLE, PixbufRcStyle))
-#define PIXBUF_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIXBUF_TYPE_RC_STYLE, PixbufRcStyleClass))
-#define PIXBUF_IS_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PIXBUF_TYPE_RC_STYLE))
-#define PIXBUF_IS_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIXBUF_TYPE_RC_STYLE))
-#define PIXBUF_RC_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIXBUF_TYPE_RC_STYLE, PixbufRcStyleClass))
-
-struct _PixbufRcStyle
-{
- GtkRcStyle parent_instance;
-
- GList *img_list;
-};
-
-struct _PixbufRcStyleClass
-{
- GtkRcStyleClass parent_class;
-};
-
-G_GNUC_INTERNAL void pixbuf_rc_style_register_type (GTypeModule *module);
+++ /dev/null
-/* GTK+ Pixbuf Engine
- * Copyright (C) 1998-2000 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Written by Owen Taylor <otaylor@redhat.com>, based on code by
- * Carsten Haitzler <raster@rasterman.com>
- */
-
-#include <string.h>
-
-#include "pixbuf.h"
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-static GHashTable *pixbuf_cache = NULL;
-
-static GdkPixbuf *
-bilinear_gradient (GdkPixbuf *src,
- gint src_x,
- gint src_y,
- gint width,
- gint height)
-{
- guint n_channels = gdk_pixbuf_get_n_channels (src);
- guint src_rowstride = gdk_pixbuf_get_rowstride (src);
- guchar *src_pixels = gdk_pixbuf_get_pixels (src);
- guchar *p1, *p2, *p3, *p4;
- guint dest_rowstride;
- guchar *dest_pixels;
- GdkPixbuf *result;
- int i, j, k;
-
- if (src_x == 0 || src_y == 0)
- {
- g_warning ("invalid source position for bilinear gradient");
- return NULL;
- }
-
- p1 = src_pixels + (src_y - 1) * src_rowstride + (src_x - 1) * n_channels;
- p2 = p1 + n_channels;
- p3 = src_pixels + src_y * src_rowstride + (src_x - 1) * n_channels;
- p4 = p3 + n_channels;
-
- result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, n_channels == 4, 8,
- width, height);
-
- if (result == NULL)
- {
- g_warning ("failed to create a %dx%d pixbuf", width, height);
- return NULL;
- }
-
- dest_rowstride = gdk_pixbuf_get_rowstride (result);
- dest_pixels = gdk_pixbuf_get_pixels (result);
-
- for (i = 0; i < height; i++)
- {
- guchar *p = dest_pixels + dest_rowstride *i;
- guint v[4];
- gint dv[4];
-
- for (k = 0; k < n_channels; k++)
- {
- guint start = ((height - i) * p1[k] + (1 + i) * p3[k]) / (height + 1);
- guint end = ((height - i) * p2[k] + (1 + i) * p4[k]) / (height + 1);
-
- dv[k] = (((gint)end - (gint)start) << 16) / (width + 1);
- v[k] = (start << 16) + dv[k] + 0x8000;
- }
-
- for (j = width; j; j--)
- {
- for (k = 0; k < n_channels; k++)
- {
- *(p++) = v[k] >> 16;
- v[k] += dv[k];
- }
- }
- }
-
- return result;
-}
-
-static GdkPixbuf *
-horizontal_gradient (GdkPixbuf *src,
- gint src_x,
- gint src_y,
- gint width,
- gint height)
-{
- guint n_channels = gdk_pixbuf_get_n_channels (src);
- guint src_rowstride = gdk_pixbuf_get_rowstride (src);
- guchar *src_pixels = gdk_pixbuf_get_pixels (src);
- guint dest_rowstride;
- guchar *dest_pixels;
- GdkPixbuf *result;
- int i, j, k;
-
- if (src_x == 0)
- {
- g_warning ("invalid source position for horizontal gradient");
- return NULL;
- }
-
- result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, n_channels == 4, 8,
- width, height);
-
- if (result == NULL)
- {
- g_warning ("failed to create a %dx%d pixbuf", width, height);
- return NULL;
- }
-
- dest_rowstride = gdk_pixbuf_get_rowstride (result);
- dest_pixels = gdk_pixbuf_get_pixels (result);
-
- for (i = 0; i < height; i++)
- {
- guchar *p = dest_pixels + dest_rowstride *i;
- guchar *p1 = src_pixels + (src_y + i) * src_rowstride + (src_x - 1) * n_channels;
- guchar *p2 = p1 + n_channels;
-
- guint v[4];
- gint dv[4];
-
- for (k = 0; k < n_channels; k++)
- {
- dv[k] = (((gint)p2[k] - (gint)p1[k]) << 16) / (width + 1);
- v[k] = (p1[k] << 16) + dv[k] + 0x8000;
- }
-
- for (j = width; j; j--)
- {
- for (k = 0; k < n_channels; k++)
- {
- *(p++) = v[k] >> 16;
- v[k] += dv[k];
- }
- }
- }
-
- return result;
-}
-
-static GdkPixbuf *
-vertical_gradient (GdkPixbuf *src,
- gint src_x,
- gint src_y,
- gint width,
- gint height)
-{
- guint n_channels = gdk_pixbuf_get_n_channels (src);
- guint src_rowstride = gdk_pixbuf_get_rowstride (src);
- guchar *src_pixels = gdk_pixbuf_get_pixels (src);
- guchar *top_pixels, *bottom_pixels;
- guint dest_rowstride;
- guchar *dest_pixels;
- GdkPixbuf *result;
- int i, j;
-
- if (src_y == 0)
- {
- g_warning ("invalid source position for vertical gradient");
- return NULL;
- }
-
- top_pixels = src_pixels + (src_y - 1) * src_rowstride + (src_x) * n_channels;
- bottom_pixels = top_pixels + src_rowstride;
-
- result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, n_channels == 4, 8,
- width, height);
-
- if (result == NULL)
- {
- g_warning ("failed to create a %dx%d pixbuf", width, height);
- return NULL;
- }
-
- dest_rowstride = gdk_pixbuf_get_rowstride (result);
- dest_pixels = gdk_pixbuf_get_pixels (result);
-
- for (i = 0; i < height; i++)
- {
- guchar *p = dest_pixels + dest_rowstride *i;
- guchar *p1 = top_pixels;
- guchar *p2 = bottom_pixels;
-
- for (j = width * n_channels; j; j--)
- *(p++) = ((height - i) * *(p1++) + (1 + i) * *(p2++)) / (height + 1);
- }
-
- return result;
-}
-
-static GdkPixbuf *
-replicate_single (GdkPixbuf *src,
- gint src_x,
- gint src_y,
- gint width,
- gint height)
-{
- guint n_channels = gdk_pixbuf_get_n_channels (src);
- guchar *pixels = (gdk_pixbuf_get_pixels (src) +
- src_y * gdk_pixbuf_get_rowstride (src) +
- src_x * n_channels);
- guchar r = *(pixels++);
- guchar g = *(pixels++);
- guchar b = *(pixels++);
- guint dest_rowstride;
- guchar *dest_pixels;
- guchar a = 0;
- GdkPixbuf *result;
- int i, j;
-
- if (n_channels == 4)
- a = *(pixels++);
-
- result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, n_channels == 4, 8,
- width, height);
-
- if (result == NULL)
- {
- g_warning ("failed to create a %dx%d pixbuf", width, height);
- return NULL;
- }
-
- dest_rowstride = gdk_pixbuf_get_rowstride (result);
- dest_pixels = gdk_pixbuf_get_pixels (result);
-
- for (i = 0; i < height; i++)
- {
- guchar *p = dest_pixels + dest_rowstride *i;
-
- for (j = 0; j < width; j++)
- {
- *(p++) = r;
- *(p++) = g;
- *(p++) = b;
-
- if (n_channels == 4)
- *(p++) = a;
- }
- }
-
- return result;
-}
-
-static GdkPixbuf *
-replicate_rows (GdkPixbuf *src,
- gint src_x,
- gint src_y,
- gint width,
- gint height)
-{
- guint n_channels = gdk_pixbuf_get_n_channels (src);
- guint src_rowstride = gdk_pixbuf_get_rowstride (src);
- guchar *pixels = (gdk_pixbuf_get_pixels (src) + src_y * src_rowstride + src_x * n_channels);
- guchar *dest_pixels;
- GdkPixbuf *result;
- guint dest_rowstride;
- int i;
-
- result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, n_channels == 4, 8,
- width, height);
-
- if (result == NULL)
- {
- g_warning ("failed to create a %dx%d pixbuf", width, height);
- return NULL;
- }
-
- dest_rowstride = gdk_pixbuf_get_rowstride (result);
- dest_pixels = gdk_pixbuf_get_pixels (result);
-
- for (i = 0; i < height; i++)
- memcpy (dest_pixels + dest_rowstride * i, pixels, n_channels * width);
-
- return result;
-}
-
-static GdkPixbuf *
-replicate_cols (GdkPixbuf *src,
- gint src_x,
- gint src_y,
- gint width,
- gint height)
-{
- guint n_channels = gdk_pixbuf_get_n_channels (src);
- guint src_rowstride = gdk_pixbuf_get_rowstride (src);
- guchar *pixels = (gdk_pixbuf_get_pixels (src) + src_y * src_rowstride + src_x * n_channels);
- guchar *dest_pixels;
- GdkPixbuf *result;
- guint dest_rowstride;
- int i, j;
-
- result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, n_channels == 4, 8,
- width, height);
-
- if (result == NULL)
- {
- g_warning ("failed to create a %dx%d pixbuf", width, height);
- return NULL;
- }
-
- dest_rowstride = gdk_pixbuf_get_rowstride (result);
- dest_pixels = gdk_pixbuf_get_pixels (result);
-
- for (i = 0; i < height; i++)
- {
- guchar *p = dest_pixels + dest_rowstride * i;
- guchar *q = pixels + src_rowstride * i;
-
- guchar r = *(q++);
- guchar g = *(q++);
- guchar b = *(q++);
- guchar a = 0;
-
- if (n_channels == 4)
- a = *(q++);
-
- for (j = 0; j < width; j++)
- {
- *(p++) = r;
- *(p++) = g;
- *(p++) = b;
-
- if (n_channels == 4)
- *(p++) = a;
- }
- }
-
- return result;
-}
-
-/* Scale the rectangle (src_x, src_y, src_width, src_height)
- * onto the rectangle (dest_x, dest_y, dest_width, dest_height)
- * of the destination, clip by clip_rect and render
- */
-static void
-pixbuf_render (GdkPixbuf *src,
- guint hints,
- cairo_t *cr,
- gint src_x,
- gint src_y,
- gint src_width,
- gint src_height,
- gint dest_x,
- gint dest_y,
- gint dest_width,
- gint dest_height)
-{
- GdkPixbuf *tmp_pixbuf = NULL;
- GdkRectangle rect;
- int x_offset, y_offset;
- gboolean has_alpha = gdk_pixbuf_get_has_alpha (src);
- gint src_rowstride = gdk_pixbuf_get_rowstride (src);
- gint src_n_channels = gdk_pixbuf_get_n_channels (src);
-
- if (dest_width <= 0 || dest_height <= 0)
- return;
-
- rect.x = dest_x;
- rect.y = dest_y;
- rect.width = dest_width;
- rect.height = dest_height;
-
- if (hints & THEME_MISSING)
- return;
-
- if (dest_width == src_width && dest_height == src_height)
- {
- tmp_pixbuf = g_object_ref (src);
-
- x_offset = src_x + rect.x - dest_x;
- y_offset = src_y + rect.y - dest_y;
- }
- else if (src_width == 0 && src_height == 0)
- {
- tmp_pixbuf = bilinear_gradient (src, src_x, src_y, dest_width, dest_height);
-
- x_offset = rect.x - dest_x;
- y_offset = rect.y - dest_y;
- }
- else if (src_width == 0 && dest_height == src_height)
- {
- tmp_pixbuf = horizontal_gradient (src, src_x, src_y, dest_width, dest_height);
-
- x_offset = rect.x - dest_x;
- y_offset = rect.y - dest_y;
- }
- else if (src_height == 0 && dest_width == src_width)
- {
- tmp_pixbuf = vertical_gradient (src, src_x, src_y, dest_width, dest_height);
-
- x_offset = rect.x - dest_x;
- y_offset = rect.y - dest_y;
- }
- else if ((hints & THEME_CONSTANT_COLS) && (hints & THEME_CONSTANT_ROWS))
- {
- tmp_pixbuf = replicate_single (src, src_x, src_y, dest_width, dest_height);
-
- x_offset = rect.x - dest_x;
- y_offset = rect.y - dest_y;
- }
- else if (dest_width == src_width && (hints & THEME_CONSTANT_COLS))
- {
- tmp_pixbuf = replicate_rows (src, src_x, src_y, dest_width, dest_height);
-
- x_offset = rect.x - dest_x;
- y_offset = rect.y - dest_y;
- }
- else if (dest_height == src_height && (hints & THEME_CONSTANT_ROWS))
- {
- tmp_pixbuf = replicate_cols (src, src_x, src_y, dest_width, dest_height);
-
- x_offset = rect.x - dest_x;
- y_offset = rect.y - dest_y;
- }
- else if (src_width > 0 && src_height > 0)
- {
- double x_scale = (double)dest_width / src_width;
- double y_scale = (double)dest_height / src_height;
- guchar *pixels;
- GdkPixbuf *partial_src;
-
- pixels = (gdk_pixbuf_get_pixels (src)
- + src_y * src_rowstride
- + src_x * src_n_channels);
-
- partial_src = gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB,
- has_alpha,
- 8, src_width, src_height,
- src_rowstride,
- NULL, NULL);
-
- tmp_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
- has_alpha, 8,
- rect.width, rect.height);
-
- gdk_pixbuf_scale (partial_src, tmp_pixbuf,
- 0, 0, rect.width, rect.height,
- dest_x - rect.x, dest_y - rect.y,
- x_scale, y_scale,
- GDK_INTERP_BILINEAR);
-
- g_object_unref (partial_src);
-
- x_offset = 0;
- y_offset = 0;
- }
-
- if (tmp_pixbuf)
- {
- gdk_cairo_set_source_pixbuf (cr,
- tmp_pixbuf,
- -x_offset + rect.x,
- -y_offset + rect.y);
- gdk_cairo_rectangle (cr, &rect);
- cairo_fill (cr);
-
- g_object_unref (tmp_pixbuf);
- }
-}
-
-ThemePixbuf *
-theme_pixbuf_new (void)
-{
- ThemePixbuf *result = g_new0 (ThemePixbuf, 1);
- result->filename = NULL;
- result->pixbuf = NULL;
-
- result->stretch = TRUE;
- result->border_left = 0;
- result->border_right = 0;
- result->border_bottom = 0;
- result->border_top = 0;
-
- return result;
-}
-
-void
-theme_pixbuf_destroy (ThemePixbuf *theme_pb)
-{
- if (G_LIKELY (theme_pb))
- {
- theme_pixbuf_set_filename (theme_pb, NULL);
- g_free (theme_pb);
- }
-}
-
-void
-theme_clear_pixbuf (ThemePixbuf **theme_pb)
-{
-#if GLIB_CHECK_VERSION (2, 34, 0)
- g_clear_pointer (theme_pb, theme_pixbuf_destroy);
-#else
- if (*theme_pb)
- {
- theme_pixbuf_destroy (*theme_pb);
- *theme_pb = NULL;
- }
-#endif
-}
-
-void
-theme_pixbuf_set_filename (ThemePixbuf *theme_pb,
- const char *filename)
-{
- if (theme_pb->pixbuf)
- {
- g_object_unref (theme_pb->pixbuf);
- theme_pb->pixbuf = NULL;
- }
-
- g_free (theme_pb->filename);
-
- if (filename)
- theme_pb->filename = g_strdup (filename);
- else
- theme_pb->filename = NULL;
-}
-
-static guint
-compute_hint (GdkPixbuf *pixbuf,
- gint x0,
- gint x1,
- gint y0,
- gint y1)
-{
- int i, j;
- int hints = THEME_CONSTANT_ROWS | THEME_CONSTANT_COLS | THEME_MISSING;
- int n_channels = gdk_pixbuf_get_n_channels (pixbuf);
-
- guchar *data = gdk_pixbuf_get_pixels (pixbuf);
- int rowstride = gdk_pixbuf_get_rowstride (pixbuf);
-
- if (x0 == x1 || y0 == y1)
- return 0;
-
- for (i = y0; i < y1; i++)
- {
- guchar *p = data + i * rowstride + x0 * n_channels;
- guchar r = p[0];
- guchar g = p[1];
- guchar b = p[2];
- guchar a = 0;
-
- if (n_channels == 4)
- a = p[3];
-
- for (j = x0; j < x1 ; j++)
- {
- if (n_channels != 4 || p[3] != 0)
- {
- hints &= ~THEME_MISSING;
- if (!(hints & THEME_CONSTANT_ROWS))
- goto cols;
- }
-
- if (r != *(p++) ||
- g != *(p++) ||
- b != *(p++) ||
- (n_channels != 4 && a != *(p++)))
- {
- hints &= ~THEME_CONSTANT_ROWS;
- if (!(hints & THEME_MISSING))
- goto cols;
- }
- }
- }
-
- cols:
- for (i = y0 + 1; i < y1; i++)
- {
- guchar *base = data + y0 * rowstride + x0 * n_channels;
- guchar *p = data + i * rowstride + x0 * n_channels;
-
- if (memcmp (p, base, n_channels * (x1 - x0)) != 0)
- {
- hints &= ~THEME_CONSTANT_COLS;
- return hints;
- }
- }
-
- return hints;
-}
-
-static void
-theme_pixbuf_compute_hints (ThemePixbuf *theme_pb)
-{
- int i, j;
- gint width = gdk_pixbuf_get_width (theme_pb->pixbuf);
- gint height = gdk_pixbuf_get_height (theme_pb->pixbuf);
-
- if (theme_pb->border_left + theme_pb->border_right > width ||
- theme_pb->border_top + theme_pb->border_bottom > height)
- {
- g_warning ("Invalid borders specified for theme pixmap:\n"
- " %s,\n"
- "borders don't fit within the image", theme_pb->filename);
- if (theme_pb->border_left + theme_pb->border_right > width)
- {
- theme_pb->border_left = width / 2;
- theme_pb->border_right = (width + 1) / 2;
- }
- if (theme_pb->border_bottom + theme_pb->border_top > height)
- {
- theme_pb->border_top = height / 2;
- theme_pb->border_bottom = (height + 1) / 2;
- }
- }
-
- for (i = 0; i < 3; i++)
- {
- gint y0, y1;
-
- switch (i)
- {
- case 0:
- y0 = 0;
- y1 = theme_pb->border_top;
- break;
- case 1:
- y0 = theme_pb->border_top;
- y1 = height - theme_pb->border_bottom;
- break;
- default:
- y0 = height - theme_pb->border_bottom;
- y1 = height;
- break;
- }
-
- for (j = 0; j < 3; j++)
- {
- gint x0, x1;
-
- switch (j)
- {
- case 0:
- x0 = 0;
- x1 = theme_pb->border_left;
- break;
- case 1:
- x0 = theme_pb->border_left;
- x1 = width - theme_pb->border_right;
- break;
- default:
- x0 = width - theme_pb->border_right;
- x1 = width;
- break;
- }
-
- theme_pb->hints[i][j] = compute_hint (theme_pb->pixbuf, x0, x1, y0, y1);
- }
- }
-
-}
-
-void
-theme_pixbuf_set_border (ThemePixbuf *theme_pb,
- gint left,
- gint right,
- gint top,
- gint bottom)
-{
- theme_pb->border_left = left;
- theme_pb->border_right = right;
- theme_pb->border_top = top;
- theme_pb->border_bottom = bottom;
-
- if (theme_pb->pixbuf)
- theme_pixbuf_compute_hints (theme_pb);
-}
-
-void
-theme_pixbuf_set_stretch (ThemePixbuf *theme_pb,
- gboolean stretch)
-{
- theme_pb->stretch = stretch;
-
- if (theme_pb->pixbuf)
- theme_pixbuf_compute_hints (theme_pb);
-}
-
-void
-theme_pixbuf_uncache (gpointer data,
- GObject *where_the_object_was)
-{
- g_hash_table_remove (pixbuf_cache, data);
-}
-
-GdkPixbuf *
-theme_pixbuf_get_pixbuf (ThemePixbuf *theme_pb)
-{
- if (!theme_pb->pixbuf)
- {
- gpointer pixbuf;
-
- if (!pixbuf_cache)
- /* Hash table does not hold its own reference to the GdkPixbuf */
- pixbuf_cache = g_hash_table_new_full (g_str_hash, g_str_equal,
- g_free, NULL);
-
- /* Do an extended lookup because we store NULL in the hash table
- * (below) to indicate that we failed to load the given filename.
- */
- if (!g_hash_table_lookup_extended (pixbuf_cache, theme_pb->filename,
- NULL, &pixbuf))
- /* Not in the cache. Add it and take the first ref. */
- {
- gchar *key = g_strdup (theme_pb->filename);
- GError *error = NULL;
-
- pixbuf = gdk_pixbuf_new_from_file (key, &error);
-
- if (pixbuf != NULL)
- {
- /* Drop the pixbuf from the cache when we lose the last ref. */
- g_object_weak_ref (G_OBJECT (pixbuf), theme_pixbuf_uncache, key);
- }
- else
- {
- /* Never drop a negative from the cache. */
- g_warning ("Pixbuf theme: Cannot load pixmap file %s: %s\n",
- theme_pb->filename, error->message);
- g_error_free (error);
- }
-
- /* Always insert, even if we failed to create the pixbuf. */
- g_hash_table_insert (pixbuf_cache, key, pixbuf);
- theme_pb->pixbuf = pixbuf;
- }
-
- else
- /* In the cache. Take an additional ref. */
- theme_pb->pixbuf = g_object_ref (pixbuf);
-
- if (theme_pb->stretch)
- theme_pixbuf_compute_hints (theme_pb);
- }
-
- return theme_pb->pixbuf;
-}
-
-void
-theme_pixbuf_render (ThemePixbuf *theme_pb,
- cairo_t *cr,
- guint component_mask,
- gboolean center,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GdkPixbuf *pixbuf = theme_pixbuf_get_pixbuf (theme_pb);
- gint src_x[4], src_y[4], dest_x[4], dest_y[4];
- gint pixbuf_width = gdk_pixbuf_get_width (pixbuf);
- gint pixbuf_height = gdk_pixbuf_get_height (pixbuf);
-
- if (!pixbuf)
- return;
-
- if (theme_pb->stretch)
- {
- if (component_mask & COMPONENT_ALL)
- component_mask = (COMPONENT_ALL - 1) & ~component_mask;
-
- src_x[0] = 0;
- src_x[1] = theme_pb->border_left;
- src_x[2] = pixbuf_width - theme_pb->border_right;
- src_x[3] = pixbuf_width;
-
- src_y[0] = 0;
- src_y[1] = theme_pb->border_top;
- src_y[2] = pixbuf_height - theme_pb->border_bottom;
- src_y[3] = pixbuf_height;
-
- dest_x[0] = x;
- dest_x[1] = x + theme_pb->border_left;
- dest_x[2] = x + width - theme_pb->border_right;
- dest_x[3] = x + width;
-
- if (dest_x[1] > dest_x[2])
- {
- component_mask &= ~(COMPONENT_NORTH | COMPONENT_SOUTH | COMPONENT_CENTER);
- dest_x[1] = dest_x[2] = (dest_x[1] + dest_x[2]) / 2;
- }
-
- dest_y[0] = y;
- dest_y[1] = y + theme_pb->border_top;
- dest_y[2] = y + height - theme_pb->border_bottom;
- dest_y[3] = y + height;
-
- if (dest_y[1] > dest_y[2])
- {
- component_mask &= ~(COMPONENT_EAST | COMPONENT_WEST | COMPONENT_CENTER);
- dest_y[1] = dest_y[2] = (dest_y[1] + dest_y[2]) / 2;
- }
-
-
-
-#define RENDER_COMPONENT(X1,X2,Y1,Y2) \
- pixbuf_render (pixbuf, theme_pb->hints[Y1][X1], cr, \
- src_x[X1], src_y[Y1], \
- src_x[X2] - src_x[X1], src_y[Y2] - src_y[Y1], \
- dest_x[X1], dest_y[Y1], \
- dest_x[X2] - dest_x[X1], dest_y[Y2] - dest_y[Y1]);
-
- if (component_mask & COMPONENT_NORTH_WEST)
- RENDER_COMPONENT (0, 1, 0, 1);
-
- if (component_mask & COMPONENT_NORTH)
- RENDER_COMPONENT (1, 2, 0, 1);
-
- if (component_mask & COMPONENT_NORTH_EAST)
- RENDER_COMPONENT (2, 3, 0, 1);
-
- if (component_mask & COMPONENT_WEST)
- RENDER_COMPONENT (0, 1, 1, 2);
-
- if (component_mask & COMPONENT_CENTER)
- RENDER_COMPONENT (1, 2, 1, 2);
-
- if (component_mask & COMPONENT_EAST)
- RENDER_COMPONENT (2, 3, 1, 2);
-
- if (component_mask & COMPONENT_SOUTH_WEST)
- RENDER_COMPONENT (0, 1, 2, 3);
-
- if (component_mask & COMPONENT_SOUTH)
- RENDER_COMPONENT (1, 2, 2, 3);
-
- if (component_mask & COMPONENT_SOUTH_EAST)
- RENDER_COMPONENT (2, 3, 2, 3);
- }
- else
- {
- if (center)
- {
- x += (width - pixbuf_width) / 2;
- y += (height - pixbuf_height) / 2;
-
- pixbuf_render (pixbuf, 0, cr,
- 0, 0,
- pixbuf_width, pixbuf_height,
- x, y,
- pixbuf_width, pixbuf_height);
- }
- else
- {
- gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
- cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
-
- cairo_rectangle (cr, x, y, width, height);
-
- cairo_fill (cr);
- }
- }
-}
+++ /dev/null
-/* GTK+ Pixbuf Engine
- * Copyright (C) 1998-2000 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Written by Owen Taylor <otaylor@redhat.com>, based on code by
- * Carsten Haitzler <raster@rasterman.com>
- */
-
-#include <gtk/gtk.h>
-
-typedef struct _PixbufStyle PixbufStyle;
-typedef struct _PixbufStyleClass PixbufStyleClass;
-
-extern G_GNUC_INTERNAL GType pixbuf_type_style;
-
-#define PIXBUF_TYPE_STYLE pixbuf_type_style
-#define PIXBUF_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PIXBUF_TYPE_STYLE, PixbufStyle))
-#define PIXBUF_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIXBUF_TYPE_STYLE, PixbufStyleClass))
-#define PIXBUF_IS_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PIXBUF_TYPE_STYLE))
-#define PIXBUF_IS_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIXBUF_TYPE_STYLE))
-#define PIXBUF_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIXBUF_TYPE_STYLE, PixbufStyleClass))
-
-struct _PixbufStyle
-{
- GtkStyle parent_instance;
-};
-
-struct _PixbufStyleClass
-{
- GtkStyleClass parent_class;
-};
-
-G_GNUC_INTERNAL void pixbuf_style_register_type (GTypeModule *module);
-
-
+++ /dev/null
-/* GTK+ Pixbuf Engine
- * Copyright (C) 1998-2000 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Written by Owen Taylor <otaylor@redhat.com>, based on code by
- * Carsten Haitzler <raster@rasterman.com>
- */
-
-#include <gtk/gtk.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-/* internals */
-
-typedef struct _ThemeData ThemeData;
-typedef struct _ThemeImage ThemeImage;
-typedef struct _ThemeMatchData ThemeMatchData;
-typedef struct _ThemePixbuf ThemePixbuf;
-
-enum
-{
- TOKEN_IMAGE = G_TOKEN_LAST + 1,
- TOKEN_FUNCTION,
- TOKEN_FILE,
- TOKEN_STRETCH,
- TOKEN_RECOLORABLE,
- TOKEN_BORDER,
- TOKEN_DETAIL,
- TOKEN_STATE,
- TOKEN_SHADOW,
- TOKEN_GAP_SIDE,
- TOKEN_GAP_FILE,
- TOKEN_GAP_BORDER,
- TOKEN_GAP_START_FILE,
- TOKEN_GAP_START_BORDER,
- TOKEN_GAP_END_FILE,
- TOKEN_GAP_END_BORDER,
- TOKEN_OVERLAY_FILE,
- TOKEN_OVERLAY_BORDER,
- TOKEN_OVERLAY_STRETCH,
- TOKEN_ARROW_DIRECTION,
- TOKEN_EXPANDER_STYLE,
- TOKEN_WINDOW_EDGE,
- TOKEN_D_HLINE,
- TOKEN_D_VLINE,
- TOKEN_D_SHADOW,
- TOKEN_D_POLYGON,
- TOKEN_D_ARROW,
- TOKEN_D_DIAMOND,
- TOKEN_D_OVAL,
- TOKEN_D_STRING,
- TOKEN_D_BOX,
- TOKEN_D_FLAT_BOX,
- TOKEN_D_CHECK,
- TOKEN_D_OPTION,
- TOKEN_D_CROSS,
- TOKEN_D_RAMP,
- TOKEN_D_TAB,
- TOKEN_D_SHADOW_GAP,
- TOKEN_D_BOX_GAP,
- TOKEN_D_EXTENSION,
- TOKEN_D_FOCUS,
- TOKEN_D_SLIDER,
- TOKEN_D_ENTRY,
- TOKEN_D_HANDLE,
- TOKEN_D_STEPPER,
- TOKEN_D_EXPANDER,
- TOKEN_D_RESIZE_GRIP,
- TOKEN_TRUE,
- TOKEN_FALSE,
- TOKEN_TOP,
- TOKEN_UP,
- TOKEN_BOTTOM,
- TOKEN_DOWN,
- TOKEN_LEFT,
- TOKEN_RIGHT,
- TOKEN_NORMAL,
- TOKEN_ACTIVE,
- TOKEN_PRELIGHT,
- TOKEN_SELECTED,
- TOKEN_INSENSITIVE,
- TOKEN_NONE,
- TOKEN_IN,
- TOKEN_OUT,
- TOKEN_ETCHED_IN,
- TOKEN_ETCHED_OUT,
- TOKEN_ORIENTATION,
- TOKEN_HORIZONTAL,
- TOKEN_VERTICAL,
- TOKEN_COLLAPSED,
- TOKEN_SEMI_COLLAPSED,
- TOKEN_SEMI_EXPANDED,
- TOKEN_EXPANDED,
- TOKEN_NORTH_WEST,
- TOKEN_NORTH,
- TOKEN_NORTH_EAST,
- TOKEN_WEST,
- TOKEN_EAST,
- TOKEN_SOUTH_WEST,
- TOKEN_SOUTH,
- TOKEN_SOUTH_EAST
-};
-
-typedef enum
-{
- COMPONENT_NORTH_WEST = 1 << 0,
- COMPONENT_NORTH = 1 << 1,
- COMPONENT_NORTH_EAST = 1 << 2,
- COMPONENT_WEST = 1 << 3,
- COMPONENT_CENTER = 1 << 4,
- COMPONENT_EAST = 1 << 5,
- COMPONENT_SOUTH_EAST = 1 << 6,
- COMPONENT_SOUTH = 1 << 7,
- COMPONENT_SOUTH_WEST = 1 << 8,
- COMPONENT_ALL = 1 << 9
-} ThemePixbufComponent;
-
-typedef enum {
- THEME_MATCH_GAP_SIDE = 1 << 0,
- THEME_MATCH_ORIENTATION = 1 << 1,
- THEME_MATCH_STATE = 1 << 2,
- THEME_MATCH_SHADOW = 1 << 3,
- THEME_MATCH_ARROW_DIRECTION = 1 << 4,
- THEME_MATCH_EXPANDER_STYLE = 1 << 5,
- THEME_MATCH_WINDOW_EDGE = 1 << 6
-} ThemeMatchFlags;
-
-typedef enum {
- THEME_CONSTANT_ROWS = 1 << 0,
- THEME_CONSTANT_COLS = 1 << 1,
- THEME_MISSING = 1 << 2
-} ThemeRenderHints;
-
-struct _ThemePixbuf
-{
- gchar *filename;
- GdkPixbuf *pixbuf;
- gboolean stretch;
- gint border_left;
- gint border_right;
- gint border_bottom;
- gint border_top;
- guint hints[3][3];
-};
-
-struct _ThemeMatchData
-{
- guint function; /* Mandatory */
- gchar *detail;
-
- ThemeMatchFlags flags;
-
- GtkPositionType gap_side;
- GtkOrientation orientation;
- GtkStateType state;
- GtkShadowType shadow;
- GtkArrowType arrow_direction;
- GtkExpanderStyle expander_style;
- GdkWindowEdge window_edge;
-};
-
-struct _ThemeImage
-{
- guint refcount;
-
- ThemePixbuf *background;
- ThemePixbuf *overlay;
- ThemePixbuf *gap_start;
- ThemePixbuf *gap;
- ThemePixbuf *gap_end;
-
- gchar recolorable;
-
- ThemeMatchData match_data;
-};
-
-
-G_GNUC_INTERNAL ThemePixbuf *theme_pixbuf_new (void);
-G_GNUC_INTERNAL void theme_pixbuf_destroy (ThemePixbuf *theme_pb);
-G_GNUC_INTERNAL void theme_clear_pixbuf (ThemePixbuf **theme_pb);
-G_GNUC_INTERNAL void theme_pixbuf_set_filename (ThemePixbuf *theme_pb,
- const char *filename);
-G_GNUC_INTERNAL GdkPixbuf * theme_pixbuf_get_pixbuf (ThemePixbuf *theme_pb);
-G_GNUC_INTERNAL void theme_pixbuf_set_border (ThemePixbuf *theme_pb,
- gint left,
- gint right,
- gint top,
- gint bottom);
-G_GNUC_INTERNAL void theme_pixbuf_set_stretch (ThemePixbuf *theme_pb,
- gboolean stretch);
-G_GNUC_INTERNAL void theme_pixbuf_render (ThemePixbuf *theme_pb,
- cairo_t *cr,
- guint component_mask,
- gboolean center,
- gint dest_x,
- gint dest_y,
- gint dest_width,
- gint dest_height);
-
-
-
-extern GtkStyleClass pixmap_default_class;